package org.example.lotterysystem.controller;

import jakarta.validation.Valid;
import org.example.lotterysystem.common.pojo.CommonResult;
import org.example.lotterysystem.common.utils.JacksonUtil;
import org.example.lotterysystem.controller.param.DrawPrizeParam;
import org.example.lotterysystem.service.DrawPrizeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DrawPrizeController {
    private static final Logger logger= LoggerFactory.getLogger(DrawPrizeController.class);


    @Autowired
    private DrawPrizeService drawPrizeService;
    @RequestMapping("/draw-prize")
    public CommonResult<Boolean> drawPrize(@Valid @RequestBody DrawPrizeParam param){
        logger.info("drawPrize DrawPrizeParam{}", JacksonUtil.writeValueAsString(param));
        drawPrizeService.drawPrize(param);
        return CommonResult.success(true);
    }

}
